package org.jeecg.glr.service.impl;

import org.jeecg.glr.entity.GlrFaultAlerm;
import org.jeecg.glr.mapper.GlrFaultAlermMapper;
import org.jeecg.glr.service.IGlrFaultAlermService;
import org.jeecg.glr.util.StringUtil;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 故障告警
 * @Author: jeecg-boot
 * @Date:   2020-03-09
 * @Version: V1.0
 */
@Service
public class GlrFaultAlermServiceImpl extends ServiceImpl<GlrFaultAlermMapper, GlrFaultAlerm> implements IGlrFaultAlermService {

    @Resource GlrFaultAlermMapper glrFaultAlermMapper;

    @Override
    public int getGlrFaultAlermCount() {
        String sql="select count(*) from glr_fault_alerm where 1=1";
       /* if(!SysUtil.getUserInfo().getUserType().equals(SysConstant.SYS_USER_TYPE_ADMIN)){
                sql=sql+" and sys_company_code='"+SysUtil.getUserInfo().getSysCompanyCode()+"'";
        }*/
        return glrFaultAlermMapper.getGlrFaultAlermCount(sql);
    }

    @Override
    public void processing(List<String> asList) {
        String ids="";
        for (String id :
                asList) {
            if(StringUtil.isEmpty(ids)){
                ids="'"+id+"'";
            }else{
                ids=ids+",'"+id+"'";
            }

        }
         glrFaultAlermMapper.processing(ids);
    }
}
